package cn.ctodb.wxmp.service.mapper;

import cn.ctodb.wxmp.domain.*;
import cn.ctodb.wxmp.service.dto.MessageTpDTO;

import org.mapstruct.*;
import java.util.List;

/**
 * Mapper for the entity MessageTp and its DTO MessageTpDTO.
 */
@Mapper(componentModel = "spring", uses = {})
public interface MessageTpMapper {

    @Mapping(source = "touser.id", target = "touserId")
    MessageTpDTO messageTpToMessageTpDTO(MessageTp messageTp);

    List<MessageTpDTO> messageTpsToMessageTpDTOs(List<MessageTp> messageTps);

    @Mapping(source = "touserId", target = "touser")
    MessageTp messageTpDTOToMessageTp(MessageTpDTO messageTpDTO);

    List<MessageTp> messageTpDTOsToMessageTps(List<MessageTpDTO> messageTpDTOs);

    default UserInfo userInfoFromId(Long id) {
        if (id == null) {
            return null;
        }
        UserInfo userInfo = new UserInfo();
        userInfo.setId(id);
        return userInfo;
    }
}
